|
|
|
|
|
|
|
3. Your code should look like this: |
|
|
|
|
|
|
|
|
Sub OpenDB()
Dim cDBName as String
Dim cTable as String
Dim cField1 as String
Dim cField2 as String
Dim cField3 as String
Dim cField4 as String
Dim cField5 as String
'Assign variables
cdbName = App.Path + "\Students.MDB"
cTable = "Addresses"
cField1 = "StudentID
cField2 = "Address"
cField3 = "City"
cField4 = "State"
cField5 = "Zip"
'Set the data control properties
Data1.DatabaseName = cDBName
Data1.RecordSource = cTable
'Bind the text fields
txtStudentID.DataField = cField1
txtAddress.DataField = cField2
txtCity.DataField = cField3
txtState.DataField = cField4
txtZip.DataField = cField5
'Refresh and update the data control
Data1.Refresh
End Sub |
|
|
|
|
|
|
|
|
1. Input validation occurs as the data is entered, whereas error trapping occurs after the data is entered. Input validation is used to guarantee uniformity in the data that is saved. |
|
|
|
|
|
|
|
|
2. Subtracting 32 from the lowercase value returns the uppercase value. |
|
|
|
|
|
|
|
|
3. The KeyPress event occurs whenever a key is pressed. |
|
|
|
|
|
|
|
|
4. No, a validation list can be entered in any order. |
|
|
|
|
|
|
|
|
5. The txtUpper field is being trimmed of spaces and then tested to see whether the length is anything other than zero. This code is used to test whether any values are entered into a field. The Trim command is used to remove any spaces entered into the field either intentionally or inadvertently. |
|
|
|
|
|
|
|
|
6. Conditional field validation should be performed at the form level. Users may skip around on the form using the mouse, thus making field-level validation impractical. |
|
|
|
|
|